<?php
namespace Home\Controller;
use Think\Controller;

class MiguanController extends Controller
{	



	public function index()
	{		
echo '<pre>';
		$client_secret  = C('client_secret');
		$account        = C('account');

		$url = "https://mi.juxinli.com/api/access_token?client_secret={$client_secret}&account={$account}";
		$token = file_get_contents($url);
		
		$token = json_decode($token);
		$token = $token->data->access_token;

		$url = "https://mi.juxinli.com/api/search?client_secret={$client_secret}&access_token={$token}&name={$_GET['name']}&id_card={$_GET['id_card']}&phone={$_GET['phone']}&version=v3";
		$data = file_get_contents($url);

		$data = json_decode($data);
		
		

		//判断是否成功!
		if($data->code != MIGUAN_SEARCH_SUCCESS){
			// echo '查询错误!';
			$this->error($data->message,'/',177);
		}

		print_r($data);
		//用户信息
		$this->assign('user',$data->data->user_basic);
		$this->assign('data',$data->data);

		return $this->display();


	}
}